package com.abel.lambda;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        Main m = new Main();

        m.refSum((int i, int j)->100);
        LambdaInterface iter = (i, j)->100;
        //m.calculate();
        System.out.println("======================");
        List<Integer> beforeList = Arrays.asList(1, 2, 3, 4, 5, 5, 5);
        beforeList.sort(Comparator.comparing((a)->a));
        Predicate<Integer> predicate = i -> i > 3;
        Consumer<Integer> consumer = t->{
            System.out.println(t * 2 + 10);
        };
        beforeList.stream().filter(predicate).distinct().collect(Collectors.toList()).forEach(consumer);

        Function<Integer, Integer> item = i ->2*i+1;

        System.out.println(item.apply(100));

        Callable<Integer> call = ()->10;

        Integer integer = 1;

        System.out.println(trans.apply(100));

    }

    static Function<Integer, Integer> trans = i -> 2 * i +1;

    public void refSum(LambdaInterface iter){
        System.out.println(iter.sum(1, 2));
    }

}
